<!DOCTYPE html>
<HTML>
<HEAD><meta name="viewport" content="width=device-width, initial-scale=1">
<Title>Wafer Map</Title>
<link type='text/css' rel='Stylesheet' href="maxchartapi.css" />
</HEAD>
<body bgcolor="#FFFFFF" text="#000000" topmargin="0" leftmargin="0" rightmargin="0" marginwidth="0" marginheight="0">

<p class="heading0">ChartDirector 7.0 (Java Edition)</p>
<p class="heading1">Wafer Map</p>
<hr class="separator">
<div class="content">
<img src="images/wafermap.png" width='520' height='480'>
<br><br>
This example demonstrates creating a wafer map.<br><br>
A wafer map is a discrete heat map with a circular border. (A contour chart can also be used for some applications.) It is called a wafer map because it is frequently used in the semiconductor industry to visualize properties of semiconductor wafers.<br><br>
This example is similar to <a href="discreteheatmap.htm">Discrete Heat Map</a>. The circular shape is achieved by setting the cells outside the circle to <a href="Chart.NoValue.htm">NoValue</a> to disable them.
</div>
<p class="heading1a">Source Code Listing</p>
<div class="content">
<b>[JSP Version]</b> jspdemo/wafermap.jsp
<div class='codeblock'><code class='pre'>&lt;%@page import="ChartDirector.*, java.util.*" %&gt;
&lt;%
// The diameter of the wafer
int diameter = 20;
double radius = diameter / 2.0;

// The random data array are for a square grid of 20 x 20 cells
RanSeries r = new RanSeries(2);
double[] zData = r.get2DSeries(diameter, diameter, 0, 100);

// We remove cells that are outside the wafer circle by setting them to NoValue
for(int i = 0; i &lt; zData.length; ++i) {
    double x = i % diameter + 0.5;
    double y = (i - x) / diameter + 0.5;
    if ((x - radius) * (x - radius) + (y - radius) * (y - radius) &gt; radius * radius) {
        zData[i] = Chart.NoValue;
    }
}

// Create an XYChart object of size 520 x 480 pixels.
XYChart c = new XYChart(520, 480);

// Add a title the chart with 15pt Arial Bold font
c.addTitle("Wafer Map Demonstration", "Arial Bold", 15);

// Set the plotarea at (50, 40) and of size 400 x 400 pixels. Set the backgound and border to
// transparent. Set both horizontal and vertical grid lines to light grey. (0xdddddd)
PlotArea p = c.setPlotArea(50, 40, 400, 400, -1, -1, Chart.Transparent, 0xdddddd, 0xdddddd);

// Create a discrete heat map with 20 x 20 cells
DiscreteHeatMapLayer layer = c.addDiscreteHeatMapLayer(zData, diameter);

// Set the x-axis scale. Use 8pt Arial Bold font. Set axis color to transparent, so only the labels
// visible. Set 0.5 offset to position the labels in between the grid lines.
c.xAxis().setLinearScale(0, diameter, 1);
c.xAxis().setLabelStyle("Arial Bold", 8);
c.xAxis().setColors(Chart.Transparent, Chart.TextColor);
c.xAxis().setLabelOffset(0.5);

// Set the y-axis scale. Use 8pt Arial Bold font. Set axis color to transparent, so only the labels
// visible. Set 0.5 offset to position the labels in between the grid lines.
c.yAxis().setLinearScale(0, diameter, 1);
c.yAxis().setLabelStyle("Arial Bold", 8);
c.yAxis().setColors(Chart.Transparent, Chart.TextColor);
c.yAxis().setLabelOffset(0.5);

// Position the color axis 20 pixels to the right of the plot area and of the same height as the
// plot area. Put the labels on the right side of the color axis. Use 8pt Arial Bold font for the
// labels.
ColorAxis cAxis = layer.setColorAxis(p.getRightX() + 20, p.getTopY(), Chart.TopLeft, p.getHeight(),
    Chart.Right);
cAxis.setLabelStyle("Arial Bold", 8);

// Output the chart
WebChartViewer viewer = new WebChartViewer(request, "chart1");
viewer.setChart(c, Chart.SVG);

// Include tool tip for the chart
viewer.setImageMap(c.getHTMLImageMap("", "", "title='&lt;*cdml*&gt;({xLabel}, {yLabel}) = {z|2}'"));
%&gt;
&lt;!DOCTYPE html&gt;
&lt;html&gt;
&lt;head&gt;
    &lt;title&gt;Wafer Map&lt;/title&gt;
    &lt;!-- Include ChartDirector Javascript Library to support chart interactions --&gt;
    &lt;script type="text/javascript" src="cdjcv.js"&gt;&lt;/script&gt;
&lt;/head&gt;
&lt;body style="margin:5px 0px 0px 5px"&gt;
    &lt;div style="font:bold 18pt verdana;"&gt;
        Wafer Map
    &lt;/div&gt;
    &lt;hr style="border:solid 1px #000080; background:#000080" /&gt;
    &lt;div style="font:10pt verdana; margin-bottom:1.5em"&gt;
        &lt;a href="viewsource.jsp?file=&lt;%=request.getServletPath()%&gt;"&gt;View Source Code&lt;/a&gt;
    &lt;/div&gt;
    &lt;!-- ****** Here is the chart image ****** --&gt;
    &lt;%= viewer.renderHTML(response) %&gt;
&lt;/body&gt;
&lt;/html&gt;</code></div>
</div>
<br><hr class="separator"><div class="copyright">&copy; 2022 Advanced Software Engineering Limited. All rights reserved.</div>
</body>
</HTML>
